//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;
using OpenLS.Drawing.Serialization;

namespace OpenLS.Drawing
{
    internal sealed class LegacyDrawing : IOfficeXmlSerializable
    {
        private string spid;
        private const string xmlName = "legacyDrawing";
        /// <summary>
        /// Generates an object from its XML representation
        /// </summary>
        /// <param name="context"></param>
        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read(DrawingConstants.CompatibilityNamespace + xmlName))
            {
                this.spid = c.GetOptionalString("spid");
            }
        }

        /// <summary>
        /// Convert an object into its XML representation
        /// </summary>
        /// <param name="context"></param>
        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write(DrawingConstants.CompatibilityNamespace + xmlName))
            {
                c.SetOptionalString("spid", spid);
            }
        }
    }
}